package com.base.object.each;

public class Each02 {
    public static void main(String[] args) {
        // 向上转型
        Object obj01 = new Each02Obj01("java") ;
        System.out.println(obj01);
        // 向下转型
        Each02Obj01 each02Obj01 = (Each02Obj01)obj01;
        System.out.println("name="+each02Obj01.getName());
    }
}
class Each02Obj01 {
    private String name ;
    public Each02Obj01(String name) { this.name = name; }
    @Override
    public String toString() {
        return "Each02Obj01{" +"name='" + name +'}';
    }
    public String getName() { return name; }
}
